class_name mmFile

var files:mFiles = mFiles.new()


class mFiles: # 用数组模仿集合
	var fs = []
	
	func add(fpath:String) -> void: # 添加
		var f = mFile.new()
		f.path = fpath
		fs.append(f)
	
	func remove(index:int) -> void: # 删除
		fs.remove(index)
		
	func items(index:int) -> mFile: # 集合中的项
		return fs[index]
	
	class mFile:
		var path:String # 文件路径
		
		func load() -> String:# 加载
			var file = File.new()
			var mstr = ""
			if path != "" and file.file_exists(path):
				file.open(path,File.READ)
				mstr = file.get_as_text()
				file.close()
			return mstr
			pass
			
		func save(ctn:String) -> void:# 保存
			var file = File.new()
			if path != "":
				file.open(path,File.WRITE)
				file.store_string(ctn)
				file.close()
			pass
	
